package cn.edu.fzu.homemaking.util;

import com.google.common.base.Strings;

/**
 * @author yifan
 * @date 2023/4/4
 */
public class ExceptionUtil {
    public static String getErrorMsg(Exception e) {
        String errorMsg = "";
        if (e.getCause() != null && e.getCause().getMessage() != null) {
            errorMsg = e.getCause().getMessage();
        }
        if (Strings.isNullOrEmpty(errorMsg) && e.getMessage() != null) {
            errorMsg = e.getMessage();
        }

        return errorMsg;
    }
}
